//遮罩
function zhezhao() {
    var nav_zhe = document.getElementsByClassName('nav_zhe')[0]
    var zhezhao = document.getElementsByClassName('zhezhao')[0]
    nav_zhe.onmouseover = function () {
        zhezhao.style.display = 'block'
    }
    nav_zhe.onmouseout = function () {
        zhezhao.style.display = 'none'
    }
}
zhezhao();

//加载图
window.onload = function () {
    setTimeout(function () {
        document.getElementsByClassName('banner1')[0].style.opacity = '1'
    }, 500)
}
//返回顶部
window.onscroll=function(){
    if(document.documentElement.scrollTop>0){
        document.getElementById('reTop').style.display='block';
    }else{
        document.getElementById('reTop').style.display='none';
    }
}

document.getElementById('reTop').onclick=function(){
    document.documentElement.scrollTop=0;
}


/*云计算产品*/
function product() {
    var ul = document.getElementById('proUl')
    var li = ul.children
    for (var i = 0; i < li.length; i++) {
        li[i].index = i
        li[i].onmouseover = function () {
            for (var j = 0; j < li.length; j++) {
                li[j].removeAttribute('class', 'items_active');
                li[j].children[0].children[0].style.top = '20px'
                li[j].children[0].children[0].children[0].children[0].style.opacity = '1'
                li[j].children[0].children[0].children[0].children[1].style.opacity = '0'
                li[j].children[0].children[1].style.display = 'block'
                li[j].children[0].children[2].style.display = 'none'
            }
            li[this.index].setAttribute('class', 'items_active');
            this.children[0].children[0].style.top = '-30px';
            this.children[0].children[0].children[0].children[0].style.opacity = '0'
            this.children[0].children[0].children[0].children[1].style.opacity = '1'
            this.children[0].children[1].style.display = 'none'
            this.children[0].children[2].style.display = 'block'
        }
    }
}

product();

//解决方案
function lunImg() {
    var ul = document.getElementsByClassName('points')[0];
    var points = ul.children;
    var divPar=document.getElementsByClassName('lunSib')[0]
    var div=divPar.children;
    console.log(div);
    console.log(points);
    for (var i = 0; i < points.length; i++) {
        points[i].index = i;
        points[i].onmouseover = function () {
            // console.log(1)
            for (var j = 0; j < points.length; j++) {
                points[j].firstElementChild.removeAttribute('class', 'points_active');
                points[j].lastElementChild.removeAttribute('class', 'points_text_active');
                div[j].classList.remove('lunImg_active');
                div[j].classList.remove('prev');
                div[j].classList.remove('next');
            }
            points[this.index].firstElementChild.setAttribute('class', 'points_active');
            points[this.index].lastElementChild.setAttribute('class', 'points_text_active');
            console.log((this.index))
            if(this.index==0){
                div[this.index].classList.add('lunImg_active');
                div[this.index+5].classList.add('prev');
                div[this.index+1].classList.add('next');
            }else if(this.index==5){
                div[this.index].classList.add('lunImg_active');
                div[this.index-1].classList.add('prev');
                div[this.index-5].classList.add('next');
            }else{
                div[this.index].classList.add('lunImg_active');
                div[this.index-1].classList.add('prev');
                div[this.index+1].classList.add('next');
            }
        }
    }
}
lunImg()



$(function () {
    //二级导航
    erNav()
    $(window).resize(function () {
        erNav()
    })
    function erNav() {
        if ($(window).width() > 640) {
            $('.nav').children('li').mouseenter(function () {
                $(this).children('div').addClass('show')
            }).mouseleave(function () {
                $(this).children('div').removeClass('show')
            })

        } else {
            console.log(1)
            $('.nav').children('li').unbind()
        }
    }

    //企业认证、用心服务、按需付费
    $('#imgTitl1').mouseenter(function () {
        $('.imgTitl1').addClass('imgTitl1_active')
    }).mouseleave(function () {
        $('.imgTitl1').removeClass('imgTitl1_active')
    })
    $('#imgTitl2').mouseenter(function () {
        $('.imgTitl2').addClass('imgTitl2_active')
    }).mouseleave(function () {
        $('.imgTitl2').removeClass('imgTitl2_active')
    })
    $('#imgTitl3').mouseenter(function () {
        $('.imgTitl3').addClass('imgTitl3_active')
    }).mouseleave(function () {
        $('.imgTitl3').removeClass('imgTitl3_active')
    })

    //侧导航
    console.log($('.erweima'))
    $('#iphSer').mouseenter(function(){
        $('.iph').addClass('iphShow')
    }).mouseleave(function(){
        $('.iph').removeClass('iphShow')
    })
})

